package impl;

import anaydis.sort.SorterType;
import java.util.Comparator;
import java.util.List;


public class BubbleSorter extends AbstractSorter {

    public <T> void sort(Comparator<T> tComparator, List<T> list) {
        for (int i = list.size() - 1; i > 0; i--) {
            for (int j = 0; j < i; j++) {
                if (greater(tComparator,list,j,j+1)){
                    swap(list, j, j + 1);
                }
            }
        }
    }

    public BubbleSorter() {
        super(SorterType.BUBBLE);
    }
}
